import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.util.glu.GLU.*;
import org.lwjgl.util.glu.*;

public class Main {
	
	int window_width = 800;
	int window_height = 600;
	public void start() {
		try {
			Display.setDisplayMode(new DisplayMode(window_width, window_height));
			Display.create();
		} catch (LWJGLException e) {
			e.printStackTrace();
			System.exit(0);
		}

		Display.setTitle("helloworld");
		// init OpenGL here
		initGL();

		while (!Display.isCloseRequested()) {

			// render OpenGL here
			renderGL();
			Display.update();
		}

		Display.destroy();
	}

	private void initGL() {
		glEnable(GL_DEPTH_TEST);
		glDepthFunc(GL_LEQUAL);
		glShadeModel(GL_SMOOTH);
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // LINE/FILL

		// glEnable (GL_BLEND);
		// glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		gluPerspective(60f, 1f * window_width / window_height, 0.1f, 1000f);

		gluLookAt(100, 100, 100, 0, 0, 0, 0, 1, 0);
	}

	private void renderGL(){
		glPushMatrix();
		glColor3f(1, 1, 1);
		glRectf(-50, -50, 50, 50);
		glPopMatrix();
	}
	
	public static void main(String[] argv) {
		Main displayExample = new Main();
		displayExample.start();
	}
}
